
// 引入要渲染的组件
// import HOME from '../views/home'
// import Login from '../views/login'
// import Search from '../views/search'
// import Register from '../views/register'
import ShopCart from '../views/ShopCart'
const routes = [
  { path: '/', redirect: '/home' },
  {
    name: 'home',
    path: '/home',
    component: () => import('@/views/home'),
    meta: {
      isHiddenNav: true //此属性用来表示nav是否显示
    }
  },
  {
    name: 'login',
    path: '/login',
    component: () => import('@/views/login'),
    meta: {
      isHiddenFooter: true
    }
  },
  {
    name: 'search',
    path: '/search/:keyword?',
    component: () => import('@/views/search'),
  },
  {
    name: 'register',
    path: '/register',
    // component: Register,
    component: () => import('@/views/register'),
    meta: {
      isHiddenFooter: true
    }
  },
  {
    name: 'detail',
    path: '/detail/:id',
    //懒加载组件  因为组件可能过大 让其dom解构先加载出来
    component: () => import('@/views/Detail'),
    props: true //当参数是parmas格式时props 为true,可直接在组件中用props接收
  },
  {
    // 购物车商品
    name: 'shopcart',
    path: '/shopcart',
    component: () => import('@/views/ShopCart')
  },
  {
    // 加入购物车成功
    name: 'addcartsuccess',
    path: '/addcartsuccess',
    component: () => import('@/views/AddCartSuccess')
    // component: ShopCart
  },
]

export default routes
